From: Dan Winship Date: Tue, 13 Jan 2009 20:49:31 +0000 (+0000) Subject: Make sure the animation always starts from the first frame, even if the X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~11495 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ca724920a3daa3bf83a298cf49a60bdc7265f4c7;p=gnome-shell.git Make sure the animation always starts from the first frame, even if the system is really busy and ClutterTimeline doesn't get a chance to call us until it thinks several frames have passed svn path=/trunk/; revision=147 --- diff --git a/js/ui/main.js b/js/ui/main.js index af535e314..b4e1fab62 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -64,8 +64,18 @@ ClutterFrameTicker.prototype = { // So by dynamically adjusting the value of FRAME_RATE we can trick // it into dealing with dropped frames. - let delta = frame - this._frame; - if (delta == 0) + // If there is a lot of setup to start the animation, then + // first frame number we get from clutter might be a long ways + // into the animation (or the animation might even be done). + // That looks bad, so we always start one frame into the + // animation then only do frame dropping from there. + let delta; + if (this._frame == 0) + delta = 1; + else + delta = frame - this._frame; + + if (delta == 0) // protect against divide-by-0 if we get a frame twice this.FRAME_RATE = this.TARGET_FRAME_RATE; else this.FRAME_RATE = this.TARGET_FRAME_RATE / delta;